datamatrix barcodes

arm barcodes work to be done

  • [ ] add necessary codes and text for barcodes
  • [ ] add text to the bottom of the barcode
  • [ ] ensure the text at the bottom has correct leading zeros
  • [ ] format that text so it is large enough and readable
  • [ ] center the text
  • [ ] remove the boarder from the barcode (probably just top and sides)
  • [ ] invert the image to be white on black
  • [ ] add code to name and save the image
  • [ ] resize the image to fit within a 1/2" circle
  • [ ] a 1/2" circle could be drawn on the image to ensure it fits
  • [ ] create a loop to create all of the barcodes necessary
  • [ ] find out how to combine all of the images into rows and columns
  • [ ] create loop to combine some images to a certain width
  • [ ] create loop to combine some images to a certain height
  • [ ] check to ensure it's not too wide and tall, correct for that
  • [ ] create silhouette template for cutting everything out
  • [ ] do test prints on the laser printer to ensure it looks good
  • [ ] test the template to ensure it work
  • [ ] clean everything up to ensure the techs can use it easily

payload barcodes work to be done

  • [ ] reuse the code above
  • [ ] create barcode with necessary codes imbedded
  • [ ] put necessary text to the right
  • [ ] get lockheed logo and add/overlay it on image
  • [ ] format the text to look nice
  • [ ] resize the image to fit on the handcontrollers
  • [ ] do test prints on the laser printer to ensure it looks good
  • [ ] test the template to ensure it work
  • [ ] clean everything up to ensure the techs can use it easily

this is only needed the first time to install the necessary libraries

import sys !{sys.executable} -m pip install pyStrich

insert the necessary information to create barcodes below


In [24]:
part_number = 'replace this with part number' # replace the part number (i.e. ASM-00180-00)
starting_serial_number = 12358    # insert the serial number. DO NOT USE A LEADING ZERO (i.e. 1928 not 01928)
serial_numbers_to_create = 100

# select from the menu above: Cell -> Run All

print(len(str(serial_start))) print(type(serial_start)) print('0'+str(serial_start))


In [25]:
# import all the necessary libraries to make the script work
from pystrich.datamatrix import DataMatrixEncoder
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw

In [40]:
output = part_number + str(starting_serial_number) + str(serial_numbers_to_create)
encoder = DataMatrixEncoder(output)
encoder.save("datamatrix_test.png")
# print(encoder.get_ascii())

In [43]:
img = Image.open('datamatrix_test.png')
width, height = img.size
msg = "sample text"
draw = ImageDraw.Draw(img)
w, h = draw.textsize('0'+str(starting_serial_number))
draw.text((((width-w)/2),(height-h)),'0'+str(starting_serial_number))
img.show()

In [ ]: